<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <canvas id="c" width="800" height="600" style="border: 1px solid #ccc"></canvas>

        <script>
            const cnv = document.getElementById('c')
            const ctx = cnv.getContext('2d')
            const image = new Image()
            image.src = './image/flower.png'
            image.width = 20
            image.height = 10
            image.onload = () => {
                // drawImage(image, dx, dy, dw, dh)
                ctx.drawImage(image, 30, 30, 300, 200)

                // drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh)
                // ctx.drawImage(image, 0, 0, 200, 200, 100, 100, 100, 100)
            }
        </script>
    </body>
</html>
